package com.ruoyi.legal.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.common.core.page.Pages;
import com.ruoyi.common.core.page.Query;
import com.ruoyi.common.query.QueryTool;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.legal.mapper.PackAjtzMapper;
import com.ruoyi.legal.domain.PackAjtz;
import com.ruoyi.legal.service.IPackAjtzService;

/**
 * 案件台账备份Service业务层处理
 * 
 * @author xwj
 * @date 2025-05-10
 */
@Service
public class PackAjtzServiceImpl extends ServiceImpl<PackAjtzMapper, PackAjtz> implements IPackAjtzService {
    @Autowired
    private PackAjtzMapper packAjtzMapper;

    /**
     * 查询案件台账备份
     * 
     * @param id 案件台账备份主键
     * @return 案件台账备份
     */
    @Override
    public PackAjtz selectPackAjtzById(Long id) {
        return packAjtzMapper.selectPackAjtzById(id);
    }

    /**
     * 查询案件台账备份列表
     * 
     * @param packAjtz 案件台账备份
     * @return 案件台账备份
     */
    @Override
    public List<PackAjtz> selectPackAjtzList(PackAjtz packAjtz) {
        return packAjtzMapper.selectPackAjtzList(packAjtz);
    }

    /**
     * 新增案件台账备份
     * 
     * @param packAjtz 案件台账备份
     * @return 结果
     */
    @Override
    public PackAjtz insertPackAjtz(PackAjtz packAjtz) {





        save(packAjtz);
        return packAjtz;
    }

    /**
     * 修改案件台账备份
     * 
     * @param packAjtz 案件台账备份
     * @return 结果
     */
    @Override
    public PackAjtz updatePackAjtz(PackAjtz packAjtz) {

      //  packAjtzMapper.updatePackAjtz(packAjtz);
        updateById(packAjtz);
        return packAjtz;
    }

    /**
     * 批量删除案件台账备份
     * 
     * @param ids 需要删除的案件台账备份主键
     * @return 结果
     */
    @Override
    public int deletePackAjtzByIds(Long[] ids) {
        return packAjtzMapper.deletePackAjtzByIds(ids);
    }

    /**
    * 条件删除
    * @param packAjtz 案件台账备份
    * @return
    */
    @Override
    public int delete(PackAjtz packAjtz) {
        QueryWrapper<PackAjtz> qw = new QueryWrapper<>();
        QueryTool.condition(qw, packAjtz);
        return baseMapper.delete(qw);
    }

    /**
     * mp分页
     * @param packAjtz 案件台账备份
     * @return
     */
    @Override
    public Pages<PackAjtz> queryPage(PackAjtz packAjtz) {
        QueryWrapper<PackAjtz> qw = new QueryWrapper<>();
        QueryTool.condition(qw, packAjtz);
        IPage<PackAjtz> ipage = new Query<PackAjtz>().getPage(packAjtz);

        IPage<PackAjtz> page = this.page(
                ipage,
                qw
        );
        return new Pages<>(page);
    }

    @Override
    public void deleteByPackIds(Long[] ids) {
        packAjtzMapper.deleteByPackIds(ids);
    }

    /**
     * 删除案件台账备份信息
     * 
     * @param id 案件台账备份主键
     * @return 结果
     */
    @Override
    public int deletePackAjtzById(Long id) {
        return packAjtzMapper.deletePackAjtzById(id);
    }
}
